package com.example.mybatis.mapper;

import com.example.mybatis.model.Employee;
import com.example.mybatis.model.EmployeeTO;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;

public interface EmployeeMapper {

    Employee getEmpById(@Param("deptId") Long id);

    List<Employee> queryList();

    int insert(Employee employee);

    int update(Employee employee);

    boolean deleteById(Long id);

    List<Employee> queryListByLastNameAndEmail(
            @Param("lastName") String lastName,
            @Param("email") String email);

    List<Employee> queryListByPojo(
            @Param("e") Employee employee,
            @Param("id") Long id);

    List<Employee> queryListByMap( Map<String, Object> map);
    List<Employee> queryListByTo(EmployeeTO to);


    List<Employee> queryByArray(Long[] ids);
    List<Employee> queryByCollection(
            @Param("ids") Collection<Long> collection,
            Long[] array,
            List<Long> list,
            Set<Long> set
    );

    @MapKey("id")
    Map<Long, Object> queryById(Long id);

    @MapKey("id")
    List<Map> queryListByIds(@Param("ids") Long[] ids);

    @MapKey("id")
    Map<Long, Map> queryMapByIds(@Param("ids") Long[] ids);

    List<Employee> queryListWithDept();

    List<Employee> queryListWithDept2();

    List<Employee> queryListWithDept3();

    // 鉴别器 -- discriminator 条件结果封装
    List<Employee> queryListWithDiscriminator();
}
